package com.example.demo.tree;

import java.util.HashMap;
import java.util.Random;

public class Main1 {

    public static void main(String[] args) {

        HashMap<Key, String> map = new HashMap<>();
        int size = 10000 ;

        int[] items = new int[size];
        Key[] keys = new Key[size] ;


        for(int i =0 ;i < size ; i++){
            items[i] = new Random().nextInt();
            String tmp = String.valueOf(items[i]) ;
            keys[i] = new Key(tmp);
            map.put(keys[i],tmp) ;
        }

        for(int i =0 ;i < size ; i++){
            map.remove(keys[i]) ;
        }


        System.out.println();
        System.out.println(map.size());
    }




    private static class Key {

        private String key;

        public Key(String tmp){
            this.key = tmp;
        }

        @Override
        public int hashCode() {
            return key == null ? 0 : key.hashCode() % 32;
        }

        @Override
        public boolean equals(Object o) {
            return false;
        }
    }
}
